package jmine.tec.utils.annotation.visitor;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

/**
 * Implementacao trivial que apenas olha os metodos publicos da classe e das interfaces implementadas
 * 
 * @author takeshi
 * @param <R> tipo do resultado
 */
public class PublicMembersAnnotationReader<R> extends AbstractAnnotationReader<R> {

    /**
     * {@inheritDoc}
     */
    public Collection<? extends Class<?>> selectTypes(Class<?> baseType) {
        List<Class<?>> list = new ArrayList<Class<?>>();
        list.add(baseType);
        collectInterfaces(baseType, list);
        return list;
    }

    /**
     * {@inheritDoc}
     */
    public Collection<Field> selectFields(Class<?> type) {
        return Arrays.asList(type.getFields());
    }

    /**
     * {@inheritDoc}
     */
    public Collection<Method> selectMethods(Class<?> type) {
        return Arrays.asList(type.getMethods());
    }

}
